import stack.MyStack;

import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        Stack<Integer> s = new Stack();
        s.push(1);
        s.push(2);
        s.push(3);
        s.push(4);
        s.push(5);

        System.out.println(s.size());
        // 栈顶元素
        System.out.println(s.peek());
        if(s.empty()) {
            System.out.println("栈是空的");
        } else {
            System.out.println(s.size());
        }

        System.out.println();
        System.out.println();

        MyStack myStack = new MyStack();
        myStack.push(1);
        myStack.push(2);
        myStack.push(3);
        myStack.push(4);
        myStack.push(5);
        try {
            while(!myStack.empty()) {
                System.out.println(myStack.peek());
                myStack.pop();
            }
        }catch (RuntimeException e) {
            e.printStackTrace();
        }


        int x = myStack.peek();
        System.out.println(x);
    }
}
